Changed cell area/renderer "can_focus" semantics to "is_activatable" across the board.
authorTristan Van Berkom <tristan.van.berkom@gmail.com>
Mon, 29 Nov 2010 07:29:09 +0000 (16:29 +0900)
committerTristan Van Berkom <tristan.van.berkom@gmail.com>
Mon, 29 Nov 2010 07:29:09 +0000 (16:29 +0900)
This is because focus in treeviews can be given to cells that cannot do anything
with activation (for better keynav), so we dissociate the concept of cell
activation and focusing.

gtk/gtkcellarea.c
gtk/gtkcellarea.h
gtk/gtkcellareabox.c
gtk/gtkcellrenderer.c
gtk/gtkcellrenderer.h
gtk/gtktreeview.c

index 2b07e87048458cc4a84e8c527fa4a10a9236cf2e..386af0ccebce60d0fa1c4a2dc72170e7c86107e2 100644 (file)
@@ -356,7 +356,7 @@ static void      gtk_cell_area_real_get_preferred_width_for_height (GtkCellArea
                                                                    gint                   height,
                                                                    gint                  *minimum_width,
                                                                    gint                  *natural_width);
-static gboolean  gtk_cell_area_real_can_focus                      (GtkCellArea           *area);
+static gboolean  gtk_cell_area_real_is_activatable                 (GtkCellArea           *area);
 static gboolean  gtk_cell_area_real_activate                       (GtkCellArea           *area,
                                                                    GtkCellAreaContext    *context,
                                                                    GtkWidget             *widget,
@@ -553,9 +553,9 @@ gtk_cell_area_class_init (GtkCellAreaClass *class)
   class->get_preferred_width_for_height = gtk_cell_area_real_get_preferred_width_for_height;
 
   /* focus */
-  class->can_focus  = gtk_cell_area_real_can_focus;
-  class->focus      = NULL;
-  class->activate   = gtk_cell_area_real_activate;
+  class->is_activatable = gtk_cell_area_real_is_activatable;
+  class->activate       = gtk_cell_area_real_activate;
+  class->focus          = NULL;
 
   /* Signals */
   /**
@@ -990,18 +990,18 @@ gtk_cell_area_real_get_preferred_width_for_height (GtkCellArea        *area,
 }
 
 static void
-get_can_focus (GtkCellRenderer *renderer,
-              gboolean        *can_focus)
+get_is_activatable (GtkCellRenderer *renderer,
+                   gboolean        *activatable)
 {
 
-  if (gtk_cell_renderer_can_focus (renderer))
-    *can_focus = TRUE;
+  if (gtk_cell_renderer_is_activatable (renderer))
+    *activatable = TRUE;
 }
 
 static gboolean
-gtk_cell_area_real_can_focus (GtkCellArea *area)
+gtk_cell_area_real_is_activatable (GtkCellArea *area)
 {
-  gboolean can_focus = FALSE;
+  gboolean activatable = FALSE;
 
   /* Checks if any renderer can focus for the currently applied
    * attributes.
@@ -1009,9 +1009,9 @@ gtk_cell_area_real_can_focus (GtkCellArea *area)
    * Subclasses can override this in the case that they are also
    * rendering widgets as well as renderers.
    */
-  gtk_cell_area_forall (area, (GtkCellCallback)get_can_focus, &can_focus);
+  gtk_cell_area_forall (area, (GtkCellCallback)get_is_activatable, &activatable);
 
-  return can_focus;
+  return activatable;
 }
 
 static gboolean
@@ -2326,20 +2326,20 @@ gtk_cell_area_cell_get_property (GtkCellArea        *area,
  *************************************************************/
 
 /**
- * gtk_cell_area_can_focus:
+ * gtk_cell_area_is_activatable:
  * @area: a #GtkCellArea
  *
- * Returns whether the area can receive keyboard focus,
+ * Returns whether the area can do anything when activated,
  * after applying new attributes to @area.
  *
- * Returns: whether @area can receive focus.
+ * Returns: whether @area can do anything when activated.
  */
 gboolean
-gtk_cell_area_can_focus (GtkCellArea *area)
+gtk_cell_area_is_activatable (GtkCellArea *area)
 {
   g_return_val_if_fail (GTK_IS_CELL_AREA (area), FALSE);
 
-  return GTK_CELL_AREA_GET_CLASS (area)->can_focus (area);
+  return GTK_CELL_AREA_GET_CLASS (area)->is_activatable (area);
 }
 
 /**
index 5611e65845e98354e2ffceeb95876023b8511e3b..abc73d0479e3460edf42b22737bf01378b2c6c84 100644 (file)
@@ -144,7 +144,7 @@ struct _GtkCellAreaClass
                                                          GParamSpec              *pspec);
 
   /* Focus */
-  gboolean           (* can_focus)                       (GtkCellArea             *area);
+  gboolean           (* is_activatable)                  (GtkCellArea             *area);
   gboolean           (* focus)                           (GtkCellArea             *area,
                                                          GtkDirectionType         direction);
   gboolean           (* activate)                        (GtkCellArea             *area,
@@ -285,14 +285,14 @@ void                  gtk_cell_area_cell_get_property              (GtkCellArea
 
 
 /* Focus */
-gboolean              gtk_cell_area_can_focus                      (GtkCellArea         *area);
-gboolean              gtk_cell_area_focus                          (GtkCellArea         *area,
-                                                                   GtkDirectionType     direction);
+gboolean              gtk_cell_area_is_activatable                 (GtkCellArea         *area);
 gboolean              gtk_cell_area_activate                       (GtkCellArea         *area,
                                                                    GtkCellAreaContext  *context,
                                                                    GtkWidget           *widget,
                                                                    const GdkRectangle  *cell_area,
                                                                    GtkCellRendererState flags);
+gboolean              gtk_cell_area_focus                          (GtkCellArea         *area,
+                                                                   GtkDirectionType     direction);
 void                  gtk_cell_area_set_focus_cell                 (GtkCellArea          *area,
                                                                    GtkCellRenderer      *renderer);
 GtkCellRenderer      *gtk_cell_area_get_focus_cell                 (GtkCellArea          *area);
index a95bc789a591e6c36441ce74be2ba98e556cef84..9d4bcbdae6ca7a0c53804f8dbc25d475d97583aa 100644 (file)
@@ -1138,7 +1138,7 @@ gtk_cell_area_box_render (GtkCellArea          *area,
 
       /* If no cell can activate but the caller wants focus painted,
        * then we paint focus around all cells */
-      if (paint_focus && !gtk_cell_area_can_focus (area))
+      if (paint_focus && !gtk_cell_area_is_activatable (area))
        focus_all = TRUE;
     }
 
index d7b77ed364b36660029e9db46cd3858c9e7217f8..dcbb6689489ee621504e45f2cf061eb5b2dc33d4 100644 (file)
@@ -1104,17 +1104,17 @@ gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell)
 
 
 /**
- * gtk_cell_renderer_can_focus:
+ * gtk_cell_renderer_is_activatable:
  * @cell: A #GtkCellRenderer
  *
- * Checks whether the cell renderer can receive focus.
+ * Checks whether the cell renderer can do something when activated.
  *
- * Returns: %TRUE if the cell renderer can do anything with keyboard focus
+ * Returns: %TRUE if the cell renderer can do anything when activated.
  *
  * Since: 3.0
  */
 gboolean
-gtk_cell_renderer_can_focus (GtkCellRenderer *cell)
+gtk_cell_renderer_is_activatable (GtkCellRenderer *cell)
 {
   GtkCellRendererPrivate *priv;
 
index 03d9df5130cc228a2b1d1d7d03dab7a19b44e114..22e86379cffa15e5d6abc5af8902d09e2f92cc9e 100644 (file)
@@ -247,7 +247,7 @@ void             gtk_cell_renderer_set_sensitive  (GtkCellRenderer      *cell,
                                                    gboolean              sensitive);
 gboolean         gtk_cell_renderer_get_sensitive  (GtkCellRenderer      *cell);
 
-gboolean         gtk_cell_renderer_can_focus      (GtkCellRenderer      *cell);
+gboolean         gtk_cell_renderer_is_activatable (GtkCellRenderer      *cell);
 
 /* For use by cell renderer implementations only */
 void             gtk_cell_renderer_stop_editing   (GtkCellRenderer      *cell,
index 2e7dc3b3bed8a16ab161f454b95ef1c764cac67e..5c4c073e7a88fecd9579a46d791a2f40b2f50a3b 100644 (file)
@@ -7804,7 +7804,7 @@ gtk_tree_view_has_can_focus_cell (GtkTreeView *tree_view)
 
       if (!gtk_tree_view_column_get_visible (column))
        continue;
-      if (gtk_cell_area_can_focus (column->cell_area))
+      if (gtk_cell_area_is_activatable (column->cell_area))
        return TRUE;
     }